<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box{
            width: 100px;
            height: 100px;
            background-color: indianred;
            position: absolute;
            left: 0;
            top: 0;
            animation: all 2s linear;
            /* 属性动画 */
        }
    </style>
</head>
<body>
    <div class="box"></div>
    <script>
        let box =document.querySelector(".box");
        function fn1(elBox) {
      return new Promise((resolve, rejected) => {
         setTimeout(() => { //延时移动才看到得过程。
          console.log("fn1");
          elBox.style.left = "500px"
          elBox.style.top = 0//写两个坐标可以，写单个变化的坐标也可以
          resolve()
        }, 1000);
      })

    }
    function fn2(elBox) {
      return new Promise((resolve, rejected) => {
        setTimeout(() => {
          console.log("fn2");
          elBox.style.left = "500px"
          elBox.style.top = "500px"
          resolve();
        }, 1000);
      })

    }
    function fn3(elBox) {
      return new Promise((resolve, rejected) => {
        setTimeout(() => {
          console.log("fn3");
          elBox.style.left = "0"
          elBox.style.top = "500px"
          resolve();
        }, 1000);
      })

    }
    function fn4(elBox) {
      return new Promise((resolve, rejected) => {
        setTimeout(() => {
          console.log("fn4");
          elBox.style.left = 0
          elBox.style.top = 0
          resolve();
        }, 1000);
      })

    }
    fn1(box).then(() => {
      return fn2(box)
    }).then(() => {
      return fn3(box)
    }).then(() => {
      return fn4(box)
    })
    </script>
</body>
</html>